{extend name="AdminEx/index" /}

{block name="main"}
<!-- page heading start-->
<div class="page-heading">
    <h3>
        {$title}
    </h3>
    <ul class="breadcrumb">
        <li>
            <a href="#">Dashboard</a>
        </li>
        <li>
            <a href="#">Data Table</a>
        </li>
        <li class="active"> Editable Table</li>
    </ul>
</div>
<!-- page heading end-->

<!--body wrapper start-->
<div class="wrapper">
    <div class="row">
        <div class="col-sm-12">
            <section class="panel">
                <header class="panel-heading">
                    查看分类
                    <span class="tools pull-right">
                        <a href="javascript:;" class="fa fa-chevron-down"></a>
                        <a href="javascript:;" class="fa fa-times"></a>
                     </span>
                </header>
                <div class="panel-body">
                    <div class="adv-table editable-table ">
                        <div class="clearfix">
                            <div class="btn-group">

                            </div>
                            <div class="btn-group pull-right">
                                <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">Tools <i
                                        class="fa fa-angle-down"></i>
                                </button>
                                <ul class="dropdown-menu pull-right">
                                    <li><a href="#">Print</a></li>
                                    <li><a href="#">Save as PDF</a></li>
                                    <li><a href="#">Export to Excel</a></li>
                                </ul>
                            </div>
                        </div>
                        <div class="space15"></div>
                        <table class="table table-striped table-hover table-bordered" id="editable-sample">
                            <thead>
                            <tr>
                                <th>id</th>
                                <th>用户名</th>
                                <th>手机号码</th>
                                <!--<th>状态</th>-->
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>

                            {volist name="data" id="v"}
                            <tr class="">
                                <td id="id">{$v.id}</td>
                                <td>{$v.name}</td>
                                <td>{$v.tel}</td>
                                <!--<td>{$v.status==0?'白名单':'黑名单'}</td>-->
                                <td>

                                        <button class="btn btn-danger btn-sm" type="button" id="info">删除</button>

                                </td>
                            </tr>
                            {/volist}

                            </tbody>
                        </table>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>


</div>
<!-- main content end-->
</section>
{/block}


{block name="myjs"}
<!--data table-->

{js href="/static/admin/js/toastr.min.js"}
{js href="/static/layout/js/jquery-1.10.2.min.js" }
{js href="/static/js/toastr.min.js"}
<script>
    $(function(){
        // 设置弹框参数
        toastr.options = {
            closeButton: true,// 是否显示关闭按钮
            progressBar: true,// 实现显示计时条
            timeOut: "3000",  // 自动关闭时间
            positionClass: "toast-top-right" // 提示位置
            // toast-top-full-width 顶端，宽度铺满整个屏幕
            // toast-top-right  顶端右边
        };

        $('#info').click(function(){
            var id = $('#id').html();
            addinfo(id)
        });

    });

    function addinfo(id) {
        $.ajax({

            type: 'post',
            url: '/Cuser/'+id,
            dataType:'json',
            success: function (data) {
                if (data.status) {
                    toastr.success(data.info);
                    setTimeout('window.location.reload()','1000');
                } else {
                    toastr.error(data.info, 'FBI WARING:');
                }
            },
            error: function () {
                toastr.error('', 'FBI WARING:');
            }
        });
    }
</script>
{/block}


